package com.dldata.devtools30.common;

public class EnumUtils {

    public static enum SEARCHLX{

        text(1,"文本框"),select(2,"下拉框"),datetime(3,"日期选择");

        SEARCHLX(Integer value,String label){
            this.value=value;
            this.label=label;
        }

        private Integer value;
        private String label;
        private String format;
        public static SEARCHLX getFormValue(Integer value) {
            for (int i = 0; i < SEARCHLX.values().length; i++) {
                SEARCHLX _enum = SEARCHLX.values()[i];
                if (_enum.value ==Integer.valueOf(value)) {
                    return _enum;
                }
            }
            return text;
        }
        public Integer getValue() {
            return value;
        }

        public void setValue(Integer value) {
            this.value = value;
        }

        public String getLabel() {
            return label;
        }

        public void setLabel(String label) {
            this.label = label;
        }

        public String getFormat() {
            return format;
        }

        public void setFormat(String format) {
            this.format = format;
        }
    }
    
    public static enum FIELDTYPE{
        
        STRING("string","字符串",Integer.MAX_VALUE),INTEGER("integer","整数",0),DATETIME("datetime","日期时间",1),DATE("date","日期",2),
        DECEMEMOL("decimal","小数",3),CASH("cash","货币",4),BOOLEAN("boolean","布尔型",Integer.MIN_VALUE);
        
        private String code;
        
        private String lable;
        
        public Integer sort;
        
        private FIELDTYPE(String code,String lable,Integer sort){
            this.sort=sort;
            this.code=code;
            this.lable=lable;
        }
        
        public String getCode() {
            return code;
        }
        public String getLable() {
            return lable;
        }
        
        public static FIELDTYPE valueOfCode(String code){
            FIELDTYPE[] items= FIELDTYPE.values();
            for (int i = 0; i < items.length; i++) {
                FIELDTYPE item = items[i];
                if(item.getCode().equals(code)){
                    return item;
                }
            }
            return  null;
        }
    }
    
    public static enum ModelTypeEnum{
        填报表单,Excel导入,数据接口;
    }
    
    public static enum StoreTypeEnum{
        json,普通;
    }
    
    public static enum FunctionTypeEnum{
        填报表单,Excel表单,BI报表;
    }
    
    public static enum ArgsType{
        替换(0,"替换"),where(1,"where");
        public int code;
        public String lable;
        private ArgsType(int code,String lable){
            this.code=code;
            this.lable=lable;
        }
        
        public static ArgsType getArgsTypeBycode(Integer code){
            ArgsType[] argsTypes = ArgsType.values();
            for (int i = 0; i < argsTypes.length; i++) {
                ArgsType argsType = argsTypes[i];
                if(code!=null&&argsType.code==code){
                    return argsType;
                }
            }
            return null;
        }
    }
}
